import { createRouter, createWebHistory } from 'vue-router'


const routes = [
  {
    path: '/',
    redirect:'/home/type/0'
  },
  {
    path: '/home',
    name: 'home',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/home/index.vue'),
    redirect:'/home/type/0',
    children:[
      {
        path:"type/:id",
        name:"type",
        component: () => import(/* webpackChunkName: "about" */ '../views/home/type.vue'),
      },
      {
        path:"comment",
        name:"comment",
        component: () => import(/* webpackChunkName: "about" */ '../views/home/comment.vue'),
      },
      {
        path:"book/:id",
        name:"book",
        component: () => import(/* webpackChunkName: "about" */ '../views/home/book.vue'),
      },
      {
        path:"chapter/:id",
        name:"chapter",
        component: () => import(/* webpackChunkName: "about" */ '../views/home/chapter.vue'),
      },
      {
        path:"top",
        name:"top",
        component: () => import(/* webpackChunkName: "about" */ '../views/home/top'),
      },
      {
        path:"full",
        name:"full",
        component: () => import(/* webpackChunkName: "about" */ '../views/home/full'),
      },
      {
        path:"collections",
        name:"collections",
        component: () => import(/* webpackChunkName: "about" */ '../views/home/collections'),
      },
      {
        path:"login",
        name:"login",
        component:() => import(/* webpackChunkName: "about" */ '../views/user/login.vue')
      },
      {
        path:"register",
        name:"register",
        component:() => import(/* webpackChunkName: "about" */ '../views/user/register.vue')
      }
    ]
  },

]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
